package ycl.important.mapper.sys;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import ycl.important.common.base.mapper.BaseDao;
import ycl.important.entity.sys.UserFriends;

/**
 * <p>
 * 用户的朋友 Mapper 接口
 * </p>
 *
 * @author YCL
 * @since 2021-06-15
 */
@Repository("userFriendsMapper")
@Mapper
public interface UserFriendsMapper extends BaseDao<UserFriends> {

	/**
	 * 根据查询对方是不是自己的朋友, 是就是true
	 *
	 * @param userId
	 * @param friendId
	 * @return
	 */
	@Select("select count(*) > 0 from sys_user_friends where user_id = #{userId} and friend_id = #{friendId} limit 1")
	boolean selectExistByUserIdFriendId(@Param("userId") Long userId, @Param("friendId") Long friendId);
}
